That is, the <#900#><TT>callbacks</TT><#900#> list associates a <#901#><EM>callback-name</EM><#901#> symbol with a
sequence of functions and their (optional) argument lists. The <#902#><EM>callback-name</EM><#902#> is used by the contact programmer to invoke each of the
associated functions with the given arguments.
<P>
Both the contact programmer and the application programmer are involved in
establishing a contact's callbacks. The contact programmer defines a set of
callback names and, for each callback, the basic argument and return value
protocol to be used. The contact programmer is also responsible for the
implementation of contact methods, in which callback functions are invoked via
the callback names. The application programmer is responsible for associating
with each callback name the actual function(s) and arguments used to implement
it. The application programmer can also extend the basic argument protocol used
by associated functions.
<P>
The relationship between a callback name and an associated function resembles
that between a method name and the code which implements it. In particular, the
set of callback names used is the same for all instances of a contact class.
These callback names and interfaces constitute a critical part of the
application programmer interface to a contact class.
<A ID="903"><tex2html_anchor_invisible_mark></A>
However, the key difference is that the associated callback functions and
arguments are instance data that are usually different for each class instance.
<P>
For example, a contact programmer may define a slider contact which uses a
callback named <#904#><TT>user-changedvalue</TT><#904#>. The contact programmer arranges for
this callback to be invoked each time the user manipulates the slider position
and for it to be passed an argument indicating the new slider value. A
programmer of a robot control application may use such a slider to
allow a user to adjust the rate at which the robot moves. The application
programmer will thus want to modify the slider's <#905#><TT>callbacks</TT><#905#> slot by adding
an element like <#906#><TT>(user-changed-value change-robot-speed)</TT><#906#>. In this case,
<#907#><TT>change-robot-speed</TT><#907#> should be an application function which accepts a
single argument specifying the new robot speed.
<P>
Callback functions are called using the <#908#><TT>apply-callback</TT><#908#> macro. The <#909#><TT>callbacks</TT><#909#> list of a contact can be modified by the functions <#910#><TT>add-callback</TT><#910#>
and <#911#><TT>delete-callback</TT><#911#>. Only one callback is involved in the basic
contact application programmer interface described in
Section~<A HREF=<tex2html_cr_mark>#ch:api#912><tex2html_cr_mark></A> --- the <#913#><TT>:destroy</TT><#913#> callback, which is called by
the primary <#914#><TT>destroy</TT><#914#> method.